<?php
/**
 * @filesource:					EntrepreneurAction.class.php
 * @desc:						主办人管理模块
 * 
 * @author:						shenyaqing
 * @copyright:					hou.yining@gmail.com
 * @date:						2011-04-19
 */
class EntrepreneurAction extends CommonCustomerAction{
	public function ___initialize(){
		$obj = D('admin_user');
		$result = $obj->where()->select();
		return $result;
	}
	public function index(){
					$crumb_info = array(
						array('uri' => '__URL__', 'title' => L('entrepreneur_manage'), 'sort' => C('CRUMB_LAST')),
					);
					$this->_mergeCrumbInfo($crumb_info);
					$this->_action_link = array(
						array('uri' => '__URL__/add/', 'title' => L('add_entrepreneur')),
					);
					$this->assign('crumb_info', $this->_crumb_info);
					$this->assign('action_link', $this->_action_link);
					//重写父类index方法
					$model = D ('general_customer');
					$id = $_REQUEST['id'];
					$map = "type_id='$id'";
					if (! empty ( $model )) {
						$this->_list ( $model, $map );
					}
					$this->display ();
					

		}

	
	public function add(){
		$vol = $this->___initialize();
		$this->assign('vol',$vol);
		$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('entrepreneur_manage'), 'sort' => C('CRUMB_DEFAULT')),
			array('uri' => '__URL__/add', 'title' => L('add_entrepreneur'), 'sort' => C('CRUMB_LAST')),
		);
		
		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/index/id/4', 'title' => L('list_entrepreneur')),
			);
		
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		parent::add();
	}
	public function edit(){
		$vol = $this->___initialize();
		$this->assign('vol',$vol);
		$crumb_info = array(
			array('uri' => '__URL__', 'title' => L('entrepreneur_manage'), 'sort' => C('CRUMB_DEFAULT')),
			array('uri' => '__URL__/edit/id/' . $_REQUEST['id'], 'title' => L('edit_entrepreneur'), 'sort' => C('CRUMB_LAST')),
		);

		$this->_mergeCrumbInfo($crumb_info);
		$this->_action_link = array(
			array('uri' => '__URL__/index/id/4', 'title' => L('list_entrepreneur')),
			);
		
		$this->assign('crumb_info', $this->_crumb_info);
		$this->assign('action_link', $this->_action_link);
		
		$model = M ( 'general_customer' );
		$id = $_REQUEST [$model->getPk ()];
		$vo = $model->getById ( $id );
		$this->assign ( 'vo', $vo );
		
		$this->display ();
	}
	public function search(){
		$model = M ( 'general_customer' );
		//$result = parent::_search();
		$where = $_POST['search'];
		$result = $model->where("name='$where'")->select(); 
		$this->assign('list',$result);
		$this->display('index');
	}
	public function all_delete(){
    	parent::all_delete();
		echo "<script>alert('已全部删除！');window.location.href('".ROOT_PATH."Entrepreneur/index/id/4');</script>";
    }
	
	
}
?>